
// json_serializable 转换json
// {
//   "model": "gpt-3.5-turbo",
//   "messages": [{"role": "user", "content": "Hello!"}]
// }

import 'package:json_annotation/json_annotation.dart';

part 'gpt_message_post.g.dart';

@JsonSerializable()
class GptMessagePost {
  String model;
  List<Messages> messages;

  GptMessagePost(this.model, this.messages);

  factory GptMessagePost.fromJson(Map<String, dynamic> json) =>
      _$GptMessagePostFromJson(json);

  Map<String, dynamic> toJson() => _$GptMessagePostToJson(this);
}

@JsonSerializable()
class Messages {
  String role;
  String content;

  Messages(this.role, this.content);

  factory Messages.fromJson(Map<String, dynamic> json) =>
      _$MessagesFromJson(json);

  Map<String, dynamic> toJson() => _$MessagesToJson(this);
}
